package com.mini.service.impl;

import com.mini.dao.ServerComputerInfoMapper;
import com.mini.pojo.basic.ServerComputerInfo;
import com.mini.service.ServerComputerInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class ServerComputerInfoServiceImpl implements ServerComputerInfoService {

    @Autowired
    private ServerComputerInfoMapper serverComputerInfoMapper;

    public void addServerComputerInfo(ServerComputerInfo serverComputerInfo) {

        serverComputerInfo.setCreatedBy("test");
        serverComputerInfo.setUpdatedBy("test");
        serverComputerInfo.setCreatedTime(new Date());
        serverComputerInfo.setUpdatedTime(new Date());
        serverComputerInfoMapper.addServerComputerInfo(serverComputerInfo);

    }

    public void updateServerComputerInfo(ServerComputerInfo serverComputerInfo) {
        serverComputerInfo.setUpdatedBy("test");
        serverComputerInfo.setUpdatedTime(new Date());
        serverComputerInfoMapper.updateServerComputerInfo(serverComputerInfo);

    }

    public int removeServerComputerInfo(int servercomputerinfoId) {
        ServerComputerInfo serverComputerInfo = serverComputerInfoMapper.queryServerComputerInfo(servercomputerinfoId);
        serverComputerInfo.setUpdatedBy("test");
        serverComputerInfo.setUpdatedTime(new Date());
        return serverComputerInfoMapper.removeServerComputerInfo(serverComputerInfo);
    }

    public ServerComputerInfo queryServerComputerInfo(int servercomputerinfoId) {
        return serverComputerInfoMapper.queryServerComputerInfo(servercomputerinfoId);
    }

    public List<ServerComputerInfo> queryAllServerComputerInfo() {
        return serverComputerInfoMapper.queryAllServerComputerInfo();
    }

    public List<ServerComputerInfo> querySomeServerComputerInfo(int serverinfoId) {
        return serverComputerInfoMapper.querySomeServerComputerInfo(serverinfoId);
    }
}
